<!--继承的父类模板位于：Application\Home\View\default\Addons\param.html -->
<extend name="param"/>
<block name="css">
<link href="{:ADDON_PUBLIC_PATH}/css/diy.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
</block>
<!--参数配置模块 一般情况widget里的param.html继承此模板后只需要重写baseSetting代码块即可-->
<block name="baseSetting">
<form id="baseSettingForm" class="edit_module_form form-horizontal">
	<div class="form-item">
    	<label class="item-label">显示模板:<span class="check-tips"></span></label>
        <div class="controls">
			<select name="template" id="template">
					<option value="simple" <eq name="template" value="simple">selected</eq> >普通列表模板</option>
                    <option value="underline" <eq name="template" value="underline">selected</eq> >带下滑线列表模板</option>
                    <option value="lishow" <eq name="template" value="lishow">selected</eq> >带修饰符列表模板</option>

                    <option value="$widget_id" id="custom_template" <eq name="template" value="widget_id">selected</eq> >自定义模板</option>

			</select>
		</div>
        <a class="edithtml" href="javascript:;">编辑模板</a>
	</div>
    <php>if(!empty($title)) { foreach($title as $i=>$vo) { 
    </php>
     <div class="form-col">
        <div class="form-item">
            <label class="item-label">标题:<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" name="title[{$i}]" class="text input-large" value="{$vo}">
            </div>
        </div>
        <div class="form-item cf">
                <label class="item-label">超链接:<span class="check-tips"></span></label>
                <div class="controls">
                   <input type="text" name="url[{$i}]" class="text input-large" value="{$url.$i}">
                </div>
        </div>
        <div class="delete_item">
              <a href="javascript:;" class="deleteBtn" onclick="$(this).parents('.form-col').remove();">删除</a>
        </div>
    </div>   
    <php>  } } else{ </php>
    <div class="form-col">
        <div class="form-item">
            <label class="item-label">标题:<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" name="title[]" class="text input-large" value="">
            </div>
        </div>
        <div class="form-item cf">
                <label class="item-label">超链接:<span class="check-tips"></span></label>
                <div class="controls">
                   <input type="text" name="url[]" class="text input-large" value="">
                </div>
        </div>
        <div class="delete-item">
              <a href="javascript:;" class="deleteBtn" onclick="$(this).parents('.form-col').remove();">删除</a>
        </div>
    </div>    
    <php> } </php>
    
    
    <div class="form-item cf" id="addPicItem">
        <label class="item-label"></label>
        <div class="controls">
           <a href="javascript:;" id="addPic">添加</a>
        </div>
    </div>
    
    <div class="form-item cf">
    	<label class="item-label"></label>
        <div class="controls">
           <button type="button" id="confirm" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定</button>
           <button type="button" class="btn preview_btn">预 览</button>
        </div>
    </div>
</form>
</block>

<block name="script">
<script src="{:ADDON_PUBLIC_PATH}/js/form.js?v={:SITE_VERSION}" type="text/javascript"></script> 
<script type="text/javascript">
$('#template').change(function(){
	var val = $(this).val();
	if(val=='mult' || val=='slideshow'){
			$('#addPicItem').show();
		}else{
			$('#addPicItem').hide();
			$('.form-col').eq(0).siblings('.form-col').remove();
		}
	});
$('#addPic').click(function(){
	var size = $('.form-col').size();
	var next = size;
	var $clone = "";
	 	$clone = '<div class="form-col">'+
        '<div class="form-item">'+
            '<label class="item-label">标题:<span class="check-tips"></span></label>'+
            '<div class="controls">'+
                '<input type="text" name="title['+next+']" class="text input-large" value="">'+
            '</div>'+
        '</div>'+
        '<div class="form-item cf">'+
                '<label class="item-label">超链接:<span class="check-tips"></span></label>'+
                '<div class="controls">'+
                   '<input type="text" name="url['+next+']" class="text input-large" value="">'+
                '</div>'+
        '</div>'+
        '<div class="delete-item">'+
              '<a href="javascript:;" style="diaplay:block" class="deleteBtn" onclick="$(this).parents(\'.form-col\').remove();">删除</a>'+
        '</div>'+
    '</div> '; 
	$($clone).insertBefore($(this).parents('.form-item'));
	})
</script>
</block>